import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../ble/BleManager.dart';
import '../../utils/DIYColors.dart';
import '../../utils/Utils.dart';

class BleConnectPage extends StatefulWidget {
  const BleConnectPage({super.key, required this.device});

  final BluetoothDevice device;

  @override
  State<StatefulWidget> createState() {
    return _BleConnectPageState();
  }
}

class _BleConnectPageState extends State<BleConnectPage> {
  @override
  void initState() {
    super.initState();
    BleManager.instance.connect(widget.device);
    // connectManager.connect(widget.device);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true,
      backgroundColor: DIYColors.gray_f4,
      appBar: Utils.instance.appBarLeft(context, "添加设备"),
      body: SafeArea(
          child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Text("设备连接页面",
              style: TextStyle(color: DIYColors.orange_ed, fontSize: 15.sp))
        ],
      )),
    );
  }

  // ConnectManager connectManager = ConnectManager(GattCallback(
  //     onDeviceNotFind: () {},
  //     onConnected: () {},
  //     onDisconnect: () {},
  //     onRead: () {}));
}
